﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OthelloCognition
{
    public class SolversEnum
    {
        #region private
        int enumValue;
        private SolverInterface solver;
     
        private SolversEnum(int newEnumValue, SolverInterface solverAlgorithm)
        {
            enumValue = newEnumValue;
            solver = solverAlgorithm;
            SolversEnum.solversDeclared.Add(solverAlgorithm);

        }

        private static System.Collections.Generic.List<SolverInterface> solversDeclared = new List<SolverInterface>();
        #endregion


        #region public 
        public static System.Collections.Generic.List<SolverInterface> SolversDeclared
        {
            get
            {
                return solversDeclared;
            }
        }
        public int EnumValue
        {
            get
            {
                return enumValue;
            }
        }

        public static SolverInterface GetSolverByEnum(int enumValue)
        {
            SolverInterface solver;
            //for (int index = 0; solver == null && index < solversDeclared.Count; index++)
            //{
            //    if (SolversDeclared[enumValue])
            //    {
                    solver = SolversDeclared[enumValue];
            //    }
            //}
            return solver;
        }

        #endregion

        #region INSTANCES add your solvers here!!!!!!!
        public static SolversEnum HumanPlayer = new SolversEnum(0, new HumanPlayer());
        public static SolversEnum NaiveSolver = new SolversEnum(1, new NaiveSolver());
        public static SolversEnum GreedySolver = new SolversEnum(2, new GreedySolver());

#endregion

    }
}
